package com.hospital.controller;


import com.hospital.configure.Result;
import com.hospital.entity.Medicine;
import com.hospital.service.MedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author WuLiting
 * @since 2021-03-24
 */
@RestController
@RequestMapping("/medicine")
public class MedicineController {

    @Autowired
    MedicineService medicineService;

    /**
     * 添加/修改
     */
    @RequestMapping("/updateMedicine")
    public Result<Medicine> updateMedicine(@RequestBody Medicine medicine) {
        return medicineService.updateMedicine(medicine);
    }

    /**
     * 删除
     */
    @RequestMapping("/delMedicine")
    public Result<Medicine> delMedicine(@RequestBody Medicine medicine) {
        return medicineService.delMedicine(medicine);
    }

    /**
     * 批量删除
     */
    @RequestMapping("/batchDelMedicine")
    public Result<Medicine> batchDelMedicine(@RequestBody Medicine medicine) {
        return medicineService.batchDelMedicine(medicine);
    }

    /**
     * 查询(不分页)
     */
    @RequestMapping("/queryMedicine")
    public Result<Medicine> queryMedicine(@RequestBody Medicine medicine) {
        return medicineService.queryMedicine(medicine);
    }

    /**
     * 查询(分页)
     */
    @RequestMapping("/queryMedicineByPage")
    public Result<Medicine> queryMedicineByPage(@RequestBody Medicine medicine) {
        return medicineService.queryMedicineByPage(medicine);
    }

    /**
     * 根据ID查询
     */
    @RequestMapping("/queryMedicineById")
    public Result<Medicine> queryMedicineById(@RequestBody Medicine medicine) {
        return medicineService.queryMedicineById(medicine);
    }

}

